package 猫和狗抽象类版;

public class AnimalDemo {
    public static void main(String[] args) {
        //创建对象
        Animal a=new Cat();
        a.setName("1");
        a.setAge(5);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();

        a=new Cat("2",10);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();


        Animal a1=new Dog();
        a1.setName("2");
        a1.setAge(50);
        System.out.println(a1.getName()+","+a1.getAge());
        a1.eat();

        a1=new Dog("3",55);
        System.out.println(a1.getName()+","+a1.getAge());
        a1.eat();

    }
}
